<script setup>
import {useRouter} from "vue-router";


let router = useRouter()

/*
setTimeout(
    () => {
      console.log("花费了 10s");
      // router.push("/users")
      // router.push({
      //   path: "/users",
      // })
      /!*router.push(
          {
            path: "/article/1"
          }
      )*!/


      /!*router.push(
          {
            path: "/news/2",
            query: { name: 'abc', gender:'m' }

          }
      )*!/

      /!*router.replace(
          {
            name: "news",
            params:{id:3},
            query: { name: 'abc', gender:'m' }

          }
      )*!/

    },
    10000,
)
*/

let index = 1
let interval = setInterval(
    () => {
      router.push(
          {
            name: "news",
            params:{id:index},
            query: { name: 'abc', gender:'m' }

          }
      )
      index = index + 1
    },
    3000
);

setTimeout(
    () => {
      clearInterval(interval)
      console.log("停止自动跳转");
      router.go(-2)
      setTimeout(
          ()=>{
            router.go(1)
          },
          2000
      )

    }, 15000
)






</script>

<template>
  <router-view></router-view>
</template>

<style scoped>

</style>